package self.hoy.demo.tof.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import self.hoy.demo.tof.entity.Menu;
import self.hoy.demo.tof.feign.MenuFeign;
import self.hoy.demo.tof.service.MenuService;

import java.util.List;

/**
 * @author hyh
 * @date 2020/7/2
 */
@RestController
@RequestMapping("/menu")
public class MenuHandler implements MenuFeign {
    @Value("${server.port}")
    private String port;

    @Autowired
    private MenuService menuService;

    @GetMapping("/index")
    public String index() {
        return "菜单端口：" + port;
    }


    @PostMapping("/findAll")
    public List<Menu> findAll(@RequestParam("index")Integer index,
                              @RequestParam("limit")Integer limit) {
        return menuService.queryAllByLimit(index, limit);
    }

}
